<?php defined('ByShopWWI') or exit('Access Invalid!');?>

<div class="page">
  <div class="fixed-bar">
    <div class="item-title"><a class="back" href="index.php?act=cms_article&op=cms_article_list" title="返回文章列表"><i class="fa fa-arrow-circle-o-left"></i></a>
      <div class="subject">
        <h3><?php echo $lang['cms_text_artcile'];?> - <?php echo $lang['nc_new'];?></h3>
        <h5><?php echo $lang['cms_article_add_subhead'];?></h5>
      </div>
    </div>
  </div>

<form id="add_form" method="post" action="index.php?act=cms_article&op=cms_article_save" enctype="multipart/form-data">
    <div class="ncap-form-default">
        <!--分类-->
      <dl class="row">
        <dt class="tit">
          <label for="class_name"><em>*</em><?php echo $lang['class_name'];?></label>
        </dt>
        <dd class="opt">
            <select id="article_class" name="article_class_id">
                <?php if(!empty($output['article_class_list']) && is_array($output['article_class_list'])) {?>
                    <?php foreach($output['article_class_list'] as $value) {?>
                        <option value="<?php echo $value['class_id'];?>" <?php if($value['class_id'] == $output['article_detail']['article_class_id']) echo 'selected';?>><?php echo $value['class_name'];?></option>
                    <?php } ?>
                <?php } ?>
            </select>
          <span class="err"></span>
          <!--<p class="notic"><?php echo $lang['class_name_error'];?></p>-->
        </dd>
      </dl>
        <!--标题-->
        <dl class="row">
            <dt class="tit">
                <label for="article_title"><em>*</em><?php echo $lang['cms_title'];?></label>
            </dt>
            <dd class="opt">
                <input id="article_title" name="article_title" type="text" class="input-txt" value="" />
                <span class="err"></span>
                <p class="notic"><?php echo $lang['cms_title_explain'];?></p>
            </dd>
        </dl>
        <!--短标题-->
        <dl class="row">
            <dt class="tit">
                <label for="article_title_short"><em>*</em><?php echo $lang['cms_title_short'];?></label>
            </dt>
            <dd class="opt">
                <input id="article_title_short" name="article_title_short" type="text" class="input-txt" value="" />
                <span class="err"></span>
                <p class="notic"><?php echo $lang['cms_title_short_explain'];?></p>
            </dd>
        </dl>
        <!--摘要-->
        <dl class="row">
            <dt class="tit">
                <label for="article_abstract"><em>*</em><?php echo $lang['cms_article_abstract'];?></label>
            </dt>
            <dd class="opt">
                <textarea  id="article_abstract" name="article_abstract" style="width: 700px;height: 85px;"></textarea>
                <span class="err"></span>
                <p class="notic"><?php echo $lang['cms_article_abstract_explain'];?></p>
            </dd>
        </dl>
        <!--<dl class="row" id="article_image">
            <dt class="tit">
                <label for="change_article_image"><em>*</em>封面图片:</label>
            </dt>
            <dd class="opt ">
                <div class="type-file-box">
                    <div class="input-file-show">
                        <span class="type-file-box">
                            <input name="textfield" id="textfield1" class="type-file-text" type="text">
                            <input name="button" id="button1" value="选择上传..." class="type-file-button" type="button">
                            <input class="type-file-file" id="change_default_pic" name="article_image" size="30" hidefocus="true" nc_type="change_article_image" title="点击按钮选择文件并提交表单后上传生效" type="file">
                        </span>
                    </div>
                </div>
                <span class="err"></span>
                <p class="notic">请上传封面图片,系统支持的图片格式为:gif,jpg,jpeg,png</p>
            </dd>
        </dl>-->
        <!--正文-->
        <dl class="row">
            <dt class="tit">
                <label for="article_content"><em>*</em><?php echo $lang['cms_article_content'];?></label>
            </dt>
            <dd class="opt">
                <?php //showEditor('article_content','默认内容','700px','400px','visibility:hidden;',"true",$output['editor_multimedia'],'all');?>
                <?php showEditor('article_content','默认内容','700px','400px','visibility:hidden;',"true",'true','all');?>
                <span class="err"></span>
                <p class="notic"><?php echo $lang['cms_article_content_explain'];?></p>
            </dd>
        </dl>
        <!--排序-->
      <dl class="row">
        <dt class="tit">
          <label for="article_sort"><em>*</em><?php echo $lang['nc_sort'];?></label>
        </dt>
        <dd class="opt">
          <input id="article_sort" name="article_sort" type="text" class="input-txt" value="255" />
          <span class="err"></span>
          <p class="notic"><?php echo $lang['class_sort_explain'];?></p>
        </dd>
      </dl>
        <!--是否为底部文章-->
        <dl class="row">
            <dt class="tit">
                <label for="foot">是否为底部文章</label>
            </dt>
            <dd class="opt">
                <div class="onoff">
                    <label for="foot_1" class="cb-enable" title="是">是</label>
                    <label for="foot_0" class="cb-disable selected" title="否">否</label>
                    <input id="foot_1" name="foot" value="1" type="radio">
                    <input id="foot_0" name="foot" value="0" type="radio" checked="checked">
                </div>
                <p class="notic">请选择是否为底部文章</p>
            </dd>
        </dl>
      <div class="bot"><a id="submit" href="javascript:void(0)" class="ncap-btn-big ncap-btn-green"><?php echo $lang['nc_submit'];?></a></div>
    </div>
  </form>
</div>
<script type="text/javascript">
$(document).ready(function(){
    $("#submit").click(function(){
        $("#add_form").submit();
    });

    $('#add_form').validate({
        errorPlacement: function(error, element){
			var error_td = element.parent('dd').children('span.err');
            error_td.append(error);
        },
        rules : {
            class_name: {
                required : true,
                maxlength : 10
            },
            class_sort: {
                required : true,
                digits: true,
                max: 255,
                min: 0
            }
        },
        messages : {
            class_name: {
                required : "<i class='fa fa-exclamation-circle'></i><?php echo $lang['class_name_required'];?>",
                maxlength : jQuery.validator.format("<i class='fa fa-exclamation-circle'></i><?php echo $lang['class_name_maxlength'];?>")
            },
            class_sort: {
                required : "<i class='fa fa-exclamation-circle'></i><?php echo $lang['class_sort_required'];?>",
                digits: "<i class='fa fa-exclamation-circle'></i><?php echo $lang['class_sort_digits'];?>",
                max : jQuery.validator.format("<i class='fa fa-exclamation-circle'></i><?php echo $lang['class_sort_max'];?>"),
                min : jQuery.validator.format("<i class='fa fa-exclamation-circle'></i><?php echo $lang['class_sort_min'];?>")
            }
        }
    });
});
</script>